import { createApp } from 'vue'
import api from './api'
import App from './App.vue'
import router from './router'
import 'vant/lib/index.css'; // 引入样式文件
const app=createApp(App)
//在实例上绑定属性

app.config.globalProperties.$api = api;
router.beforeEach((to,from) => {
if(to.push !=='login'){
    if(!localStorage.getItem('h5_token')){
         return router.push('/login') 
    }
}
})

//路由挂载
app.use(router)
app.mount('#app')

